package com.fxpc.hddc.hdc100.jpa.dao.pg;


import com.fxpc.hddc.hdc100.dto.pg.entity.FxqhHdc100BfEntity;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Repository
public interface FxqhHdc100PgBaseDao extends JpaRepository<FxqhHdc100BfEntity, String> {

    //@Query(nativeQuery = true, value = "select uuid,province,city,district,create_time from hddc_activefault WHERE CAST(create_time AS  DATE)= DATE(:nowDay)")
    //@Query(nativeQuery = true, value = "select * from hddc_activefault WHERE create_time>=CURRENT_DATE")
    @Query(nativeQuery = true, value = "select * from fxqh_hdc100 WHERE CAST(create_time AS  DATE)= DATE(:nowDay) AND is_valid='1'")
    List<FxqhHdc100BfEntity> findPgOneDayDataByCreateTime(@Param(value = "nowDay") LocalDate nowDay);

    @Query(nativeQuery = true, value = "select * from fxqh_hdc100 WHERE  is_valid='1'")
    List<FxqhHdc100BfEntity> findAllTime();

    Long count(Specification<FxqhHdc100BfEntity> specification);
}

